import { convertToChineseNumber } from "@/utils/commonHooks";
import { getPlantsApi, getYearsApi, getWorkShopsApi } from "@/api/plant/index";
import {
  getWeeksInYear,
  getWeekNumber,
  week_date,
  getDaysOfCurrentWeek,
} from "@/utils/dateUtils";
import request from "@/utils/request";
import { getDatesBetween } from "@/components/MdmDateCalender/index";
import dayjs from "dayjs";
import type { TableColumnCtx } from "element-plus";
import { useDictStoreHook } from "@/store/modules/dictionary"; // 引入
// import Big from "big.js";
const dictionaryStore = useDictStoreHook();

// 根据id获取列表中的名称
export function getNameInfo(list: any, id: string, name: string) {
  const arr = list.filter((e: any) => e.id === id);
  return arr[0] ? arr[0][name] : "";
}

export interface WeekDetailType {
  week: number;
  date: string;
}

export interface SpanMethodProps {
  row: any;
  column: any;
  rowIndex: number;
  columnIndex: number;
  columnCount: number;
}

export interface SearchType {
  planWeek: string | number;
  planYear: string | number;
  workCenterId: string;
  plantId: string;
  plantBatch: string;
}

export const workingDays = {
  workingDayFri: 5,
  workingDayMon: 1,
  workingDaySat: 6,
  workingDaySon: 7,
  workingDayTue: 2,
  workingDayTur: 4,
  workingDayWed: 3,
};

export interface SummaryMethodProps<T = any> {
  columns: TableColumnCtx<T>[];
  data: T[];
}

export function ToChineseDate(a: any) {
  return convertToChineseNumber(a, 2) === "七"
    ? "日"
    : convertToChineseNumber(a, 2);
}

export const getSummaries = (
  param: SummaryMethodProps,
  maxCapacityLoad: number,
  columnCount: number,
  loadRates: any
) => {
  const { columns, data } = param;
  const sums: (string | VNode)[] = [];
  // 获取班产对比列的数据
  if (data.length) {
    columns.forEach((column, index) => {
      if (index <= columnCount - 1) {
        sums[index] = "";
        return;
      }
      if (index === columnCount) {
        sums[index] = h(
          "div",
          {
            style: {
              fontWeight: "600",
              textDecoration: "underline",
            },
          },
          ["负荷率"]
        );
        return;
      }

      if (
        index > columnCount &&
        loadRates &&
        loadRates[index - columnCount - 1]
      ) {
        sums[index] = h(
          "div",
          {
            style: {
              color:
                (maxCapacityLoad / 100).toFixed(2) >=
                Number(loadRates[index - columnCount - 1] ?? "")
                  ? "#222f3e"
                  : "red",
              paddingRight: "7px",
            },
          },
          [loadRates[index - columnCount - 1]]
        );
      } else {
        sums[index] = "";
      }
    });
  }

  return sums;
};

// 负荷率计算
export const calculateLoadRate = async (e: any) => {
  return new Promise(async (resolve, reject) => {
    const { data, code } = await request({
      url: "/mes/mesworkorder/loadRate",
      method: "post",
      data: e,
    }).catch(() => {
      return resolve([]);
    });
    if (code === 200) {
      return resolve(data);
    }
  });
};
// 负荷率计算xin
export const calculateLoadRateNew = async (e: any, id) => {
  return new Promise(async (resolve, reject) => {
    const { data, code } = await request({
      url: "/mes/mesworkorder/loadRateNew",
      method: "post",
      data: { list: e, workCenterId: id },
    }).catch(() => {
      return resolve([]);
    });
    if (code === 200) {
      return resolve(data);
    }
  });
};
export const objectSpanMethod = (param: any, columnCount: number) => {
  if (param.columnIndex < columnCount) {
    // console.log('param', param)
    if (param.rowIndex % 2 === 0) {
      return {
        rowspan: 2,
        colspan: 1,
      };
    } else {
      return {
        rowspan: 0,
        colspan: 0,
      };
    }
  }
};

// 获工厂列表
export function getPlantList() {
  return new Promise(async (resolve, reject) => {
    const { data } = await getPlantsApi();
    resolve(data);
  });
}

// 获取休假日期 例如：[6,7]
function getFreeDates(data: any) {
  let yearFreeDays: any = [];
  if (data && data?.plantId) {
    Object.keys(workingDays).forEach((key) => {
      if (data[key] === 0 || data[key] === null) {
        yearFreeDays = [...yearFreeDays, workingDays[key]];
      }
    });
  }
  return yearFreeDays;
}

// 获取计划休假、上班日期
function getPlanDates(data: any) {
  const planArr: any[] = [];
  data?.map((item: any) => {
    const b_date = dayjs(item.beginDate).format("YYYY-MM-DD");
    const e_date = dayjs(item.endDate).format("YYYY-MM-DD");
    const arr_date = getDatesBetween(b_date, e_date);
    const freeDayName = dictionaryStore.filterDictName(
      "FreeDayType",
      item.freeDayType
    );
    arr_date.map((e) => {
      const obj = {
        time: e,
        pollution: freeDayName.indexOf("假") !== -1 ? "休" : "班",
        freeDayType: item.freeDayType,
        freeDayName: freeDayName,
        id: item.id,
        workCalendarId: item.id,
      };
      planArr.push(obj);
    });
  });
  return planArr;
}

// 表格日期对象 [{date: '05/06', week: 1, isFree: true}, {date: '05/07', week: 2, isFree: true}...]
export function getCurrentWeekDetail(value: any, freeDetail?: any) {
  const { planYear, planWeek } = value;
  const date = week_date(planYear, planWeek);
  const arr = getDaysOfCurrentWeek(date[0]);
  const yearFreeDays = getFreeDates(freeDetail);

  const dateArr: any = [];
  if (!freeDetail) {
    arr.map((item, index) => {
      dateArr.push({
        date: item,
        week: index + 1,
        isFree: false,
      });
    });
  } else {
    const { freeDayList } = freeDetail;
    const list = getPlanDates(freeDayList);
    arr.map((item, index) => {
      const c_date = item.replace("/", "-");
      const current = list.filter((e) => e.time.indexOf(c_date) !== -1);
      let isFree = false;
      if (yearFreeDays.indexOf(index + 1) !== -1) {
        isFree = true;
      }
      if (current.length && current[0].pollution === "休") {
        isFree = true;
      }
      if (current.length && current[0].pollution === "班") {
        isFree = false;
      }
      dateArr.push({
        date: item,
        week: index + 1,
        isFree: isFree,
      });
    });
  }

  return dateArr;
}

// 新建行主体
const baseContent: any = {
  id: "",
  materialId: "", // 物料id
  materialCode: "", // 物料编号
  descriptionCode: "", // 物料编号-序号-人数
  planState: "0", // 生产状态
  yield: "", // 班产
  planQuantity: "", // 计划数量
  planBatch: "", // 计划批次
  // 批次号

  // 批次id
  plannedBatchId: "",
  // 批次数量
  batchQuantity: "",
  unPlanQuantity: "0", // 未排数量？？？
  newOrders: [],
  key: "", // 前端设置的唯一值
  planWeek: "",
  planYear: "",
  workCenterId: "",
  plantId: "",
  routingAllocationId: "", // 路线id(主键)
  autoAllocationLoading: false, // 分配中
  autoAllocation: 0, // 是否自动分配
  selected: 0,
  isPause: 0,
  requestPlanList: [], // 卷料
  defaultRequestPlanList: [], // 临时卷料
  defaultPlanQuantity: "", // 临时卷料数量
  transferTime: 0,
  planWeekQuantity: 0,
  groupType: "",
  isCasual: 0,
  orderState: "0",
};

// 固定班次
const classCount = 3;
// 计算新建行内容（根据当前周）
export function getOneLineDate(
  weekInfo: any,
  year: string | number,
  planBatch: string | number,
  searchParams: any
) {
  const weekList: string[] = [];
  weekInfo.map((item: WeekDetailType) => {
    weekList.push(item.date.split("/").join("-"));
  });
  const newOrders: any = [];
  weekList?.map((item, index) => {
    baseContent.key = generateUniqueKey();
    const obj: any = {
      planDate: `${year}-${item}`,
      newClasses: [],
    };
    for (let i = 0; i < classCount; i++) {
      obj.newClasses.push({
        planDate: `${year}-${item}`,
        id: "",
        workSequence: i + 1,
        planFinishQuantity: "",
        planQuantity: "",
      });
    }
    newOrders.push(obj);
  });

  const getWeekNumber =
    searchParams.planWeek < 10
      ? `0${searchParams.planWeek}`
      : searchParams.planWeek;

  const firstLine = {
    ...baseContent,
    planWeek: searchParams.planWeek,
    planYear: searchParams.planYear,
    workCenterId: searchParams.workCenterId,
    plantId: searchParams.plantId,
    newOrders: newOrders,
    yield: planBatch,
    // planBatch: `${searchParams.planYear}${getWeekNumber}`,
  };
  const oneLine: any = [firstLine, firstLine];
  return oneLine;
}

// 前端唯一值计算
export function generateUniqueKey() {
  const key = "key_";
  const time = Date.now().toString(36);
  const random = Math.random().toString(36).substr(2, 9);
  return key + time + random;
}

// 处理接口返回数据
export function resolveSearchData(data: any, weekInfo: any, year: any) {
  const weekList: string[] = [];
  weekInfo.map((item: WeekDetailType) => {
    weekList.push(item.date.split("/").join("-"));
  });
  let result: any = [];
  if (data?.length) {
    data.map((item: any, index: number) => {
      let sumQuantity = 0;
      item.requestPlanList?.map((item) => {
        sumQuantity += item.theoryQuantity ?? 0;
      });
      const elderItem = {
        ...item,
        defaultRequestPlanList: item.requestPlanList || [],
        defaultPlanQuantity: sumQuantity || "",
        isSureRequestPlan:
          item.requestPlanList && item.requestPlanList.length ? true : false,
        autoAllocationLoading: false,
        autoAllocation: 0,
        selected: 0,
        newOrders: [],
        key: !item.id ? generateUniqueKey() : "",
      };
      weekList?.map((self, selfIndex: number) => {
        const time = `${year}-${self}`;
        const obj: any = {
          planDate: time,
          newClasses: [],
        };
        // 先固定数据格式
        for (let i = 0; i < classCount; i++) {
          obj.newClasses.push({
            planDate: time,
            id: "",
            workSequence: i + 1,
            planFinishQuantity: "",
            planQuantity: "",
          });
        }

        // 再查找符合条件的数据，有的对应数据插入，没有的话新建值
        const arr = item.orderPlanList?.filter(
          (order) => order.planDate?.split(" ")[0] === time
        );

        // arr?.sort(function (a, b) {
        //   return a.workSequence - b.workSequence;
        // });

        // console.log("排序后的", arr, obj.newClasses);

        // arr?.map((arrSelf, arrIndex) => {
        //   obj.newClasses[arrIndex] = arrSelf;
        // });
        // 第一个单元格赋值
        const cellOne = arr?.filter((e) => e.workSequence === 1) || [];
        if (cellOne && cellOne.length) {
          obj.newClasses[0] = cellOne[0];
        }

        // // 第二个单元格赋值
        const cellTwo = arr?.filter((e) => e.workSequence === 2) || [];
        if (cellTwo && cellTwo.length) {
          obj.newClasses[1] = cellTwo[0];
        }

        // // 第三个单元格赋值
        const cellThree = arr?.filter((e) => e.workSequence === 3) || [];
        if (cellThree && cellThree.length) {
          obj.newClasses[2] = cellThree[0];
        }

        // 注入最终 obj
        elderItem.newOrders.push(obj);
      });

      const oneLine: any = [elderItem, elderItem];
      result = [...result, ...oneLine];
    });
  }

  // console.log("result", result);
  return result;
}

export function deepCopy(obj) {
  return JSON.parse(JSON.stringify(obj));
}
// 处理接口保存数据
export function resolveSaveData(table: any) {
  const data: any = [];
  const tableData = deepCopy(table);
  tableData?.map((column, columnIndex) => {
    if (columnIndex === 0 || columnIndex % 2 === 0) {
      let newColumn: any = {};
      const newOrders: any = deepCopy(column.newOrders);
      newColumn = {
        ...column,
        orderPlanList: [],
      };
      // newOrder 下钻，1、如果当前有id 则读取；2如果当前有值，读取
      for (let i = 0; i < newOrders.length; i++) {
        for (let j = 0; j < newOrders[i].newClasses.length; j++) {
          if (
            newOrders[i]?.newClasses[j]?.planQuantity
              .toString()
              ?.replace(/\s+/g, "") !== "" ||
            newOrders[i]?.newClasses[j].id
          ) {
            newColumn.orderPlanList.push(newOrders[i]?.newClasses[j]);
          }
        }
      }
      delete newColumn.newOrders;
      data.push(newColumn);
    }
  });
  return data;
}

export const mockData = [
  {
    id: "1",
    createTime: null,
    lastUpdateTime: null,
    createdUserId: null,
    lastUpdatedUserId: null,
    createdUserName: null,
    lastUpdatedUserName: null,
    producePlanCode: null,
    routingAllocationId: "1790996424073752578",
    organizationId: null,
    organizationCode: null,
    plantId: "11",
    plantCode: null,
    workshopId: null,
    workshopCode: null,
    workshopSectionId: null,
    workshopSectionCode: null,
    workCenterId: "22",
    workCenterCode: null,
    planBeginDate: null,
    planEndDate: null,
    planYear: 2024,
    planWeek: 17,
    materialId: "1790996424073752578",
    materialCode: "1111code",
    planState: 2,
    planQuantity: 1212.0,
    planBatch: "202410",
    planFinishQuantity: null,
    quantityUnit: null,
    externalCode: null,
    version: null,
    remarks: null,
    deleted: 0,
    ids: null,
    yield: "2000",
    orderPlanList: [
      {
        id: "11",
        createTime: "2024-05-06 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-23 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 1000,
        planBatch: "1",
        planFinishQuantity: 2.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 1,
      },
      {
        id: "12",
        createTime: "2024-05-05 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-22 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 1000,
        planBatch: "1",
        planFinishQuantity: 2.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 1,
      },
      {
        id: "13",
        createTime: "2024-05-06 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-23 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 1500,
        planBatch: "1",
        planFinishQuantity: 1.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 0,
      },
    ],
    requestPlanList: [
      {
        storageUnitId: "1763085874906124289",
        materialId: "1744242650296180738",
        materialCode: "1000010001",
        materialBarcode: null,
        materialWeight: 20,
        theoryQuantity: 0,
        lockedStatus: 0,
        lockedPlanId: null,
        producePlanCode: null,
        storageTypeId: "1744268785486749705",
        storageTypeName: "包装区域",
        binId: "1744302063249891330",
        binCode: "923",
      },
    ],
  },
  {
    id: "2",
    createTime: null,
    lastUpdateTime: null,
    createdUserId: null,
    lastUpdatedUserId: null,
    createdUserName: null,
    lastUpdatedUserName: null,
    producePlanCode: null,
    routingAllocationId: "1793153821559042050",
    organizationId: null,
    organizationCode: null,
    plantId: "11",
    plantCode: null,
    workshopId: null,
    workshopCode: null,
    workshopSectionId: null,
    workshopSectionCode: null,
    workCenterId: "22",
    workCenterCode: null,
    planBeginDate: null,
    planEndDate: null,
    planYear: 2024,
    planWeek: 17,
    materialId: "17996424073752578",
    materialCode: "1111code",
    planState: 0,
    planQuantity: 1212.0,
    planBatch: "202410",
    planFinishQuantity: null,
    quantityUnit: null,
    externalCode: null,
    version: null,
    remarks: null,
    deleted: 0,
    ids: null,
    yield: "3000",
    orderPlanList: [
      {
        id: "21",
        createTime: "2024-05-06 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-22 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 1.0,
        planBatch: "1",
        planFinishQuantity: 2.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 1,
      },
      {
        id: "22",
        createTime: "2024-05-05 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-22 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 1.0,
        planBatch: "1",
        planFinishQuantity: 2.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 1,
      },
      {
        id: "23",
        createTime: "2024-05-06 11:03:36",
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        produceOrderCode: "1",
        produceOrderType: 1,
        organizationId: "1",
        organizationCode: "100",
        plantId: "1737270157287362562",
        plantCode: "1000",
        workshopId: "1",
        workshopCode: "1",
        workshopSectionId: "1",
        workshopSectionCode: "1",
        workCenterId: "1",
        workCenterCode: "1",
        planDate: "2024-04-23 11:03:17",
        shiftSystemId: "1",
        shiftId: "1",
        routingAllocationId: "1",
        materialId: "1",
        materialCode: "1",
        planQuantity: 3.0,
        planBatch: "1",
        planFinishQuantity: 1.0,
        quantityUnit: "1",
        produceOrderSource: "1",
        producePlanId: "1",
        producePlanCode: "1",
        parentProduceOrderId: "1",
        orderState: "1",
        externalCode: "1",
        version: 1,
        remarks: null,
        deleted: 0,
        ids: null,
        workSequence: 0,
      },
    ],
    requestPlanList: [
      {
        id: "1",
        createTime: null,
        lastUpdateTime: null,
        createdUserId: null,
        lastUpdatedUserId: null,
        createdUserName: null,
        lastUpdatedUserName: null,
        organizationId: null,
        organizationCode: null,
        plantId: null,
        plantCode: null,
        workCenterId: null,
        workCenterCode: null,
        producePlanId: "1",
        producePlanCode: null,
        produceOrderId: null,
        produceOrderCode: null,
        planDate: null,
        planYear: null,
        planWeek: null,
        shiftSystemId: null,
        shiftId: null,
        materialId: "1111",
        materialCode: null,
        materialBarcode: null,
        workSequence: null,
        isRelease: null,
        isExecute: null,
        requestQuantity: null,
        finishQuantity: null,
        version: null,
        remarks: null,
        deleted: 0,
        ids: null,
      },
    ],
  },
];

const oneLine = [
  {
    id: "",
    materialId: "materialId", // 物料id
    materialCode: "materialCode", // 物料编号
    planState: "planState", // 生产状态
    yield: "yield", // 班产
    planQuantity: "planQuantity", // 计划数量
    planBatch: "planBatch", // 计划批次
    unPlanQuantity: "0", // 未排数量？？？
    newOrders: [
      {
        planDate: "2024-05-06",
        newClasses: [
          {
            planDate: "2024-05-06",
            id: "",
            workSequence: "1",
            planFinishQuantity: "2",
            planQuantity: "1",
          },
          {
            planDate: "2024-05-06",
            id: "",
            workSequence: "2",
            planFinishQuantity: "",
            planQuantity: "",
          },
          {
            planDate: "2024-05-06",
            id: "",
            workSequence: "3",
            planFinishQuantity: "",
            planQuantity: "",
          },
        ],
      },
      {
        planDate: "2024-05-07",
        newClasses: [
          {
            planDate: "2024-05-07",
            id: "",
            workSequence: "1",
            planFinishQuantity: "",
            planQuantity: "",
          },
          {
            planDate: "2024-05-07",
            id: "",
            workSequence: "2",
            planFinishQuantity: "",
            planQuantity: "",
          },
          {
            planDate: "2024-05-07",
            id: "",
            workSequence: "3",
            planFinishQuantity: "",
            planQuantity: "",
          },
        ],
      },
    ],
  },
  {
    id: "",
    name: "Tom",
    planBatch: "539",
    amount2: "4.1",
    amount3: 15,
  },
];

export const mockResPlans = [
  {
    id: "1",
    binCode: "binCode121212",
    binId: "binId1212",
    lockedPlanId: "lockedPlanId121212",
    lockedStatus: 0,
    materialBarcode: "string-materialBarcode",
    materialCode: "materialCode1",
    materialId: "string-materialId1",
    materialWeight: 12,
    producePlanCode: "string",
    storageTypeId: "string",
    storageTypeName: "string",
    theoryQuantity: 100,
  },
  {
    id: "2",
    binCode: "binCode121212",
    binId: "binId1212",
    lockedPlanId: "lockedPlanId121212",
    lockedStatus: 1,
    materialBarcode: "string-materialBarcode",
    materialCode: "materialCode2",
    materialId: "string-materialId2",
    materialWeight: 12,
    producePlanCode: "string",
    storageTypeId: "string",
    storageTypeName: "string",
    theoryQuantity: 300,
  },
  {
    id: "3",
    binCode: "binCode121212",
    binId: "binId1212",
    lockedPlanId: "lockedPlanId121212",
    lockedStatus: 0,
    materialBarcode: "string-materialBarcode",
    materialCode: "string-materialCode",
    materialId: "materialId3",
    materialWeight: 12,
    producePlanCode: "string",
    storageTypeId: "string",
    storageTypeName: "string",
    theoryQuantity: 200,
  },
  {
    id: "4",
    binCode: "binCode121212",
    binId: "binId1212",
    lockedPlanId: "lockedPlanId121212",
    lockedStatus: 1,
    materialBarcode: "string-materialBarcode",
    materialCode: "materialCode4",
    materialId: "string-materialId4",
    materialWeight: 12,
    producePlanCode: "string",
    storageTypeId: "string",
    storageTypeName: "string",
    theoryQuantity: 400,
  },
  {
    id: "5",
    binCode: "binCode121212",
    binId: "binId1212",
    lockedPlanId: "lockedPlanId121212",
    lockedStatus: 0,
    materialBarcode: "string-materialBarcode",
    materialCode: "materialCode5",
    materialId: "1744242650296180738",
    materialWeight: 12,
    producePlanCode: "string",
    storageTypeId: "string",
    storageTypeName: "string",
    theoryQuantity: 500,
  },
];
